class update {
    # Backup the original apt sources list 
    # if the backup files does not exist
    exec { 'backup-source':
        command => '/bin/cp /etc/apt/sources.list /etc/apt/sources.list.ori',
        creates => '/etc/apt/sources.list.ori',
    }

    # Imports the local sources list
    file { '/etc/apt/sources.list':
        ensure => present,
        owner => root,
        group => root,
        source => '/vagrant/modules/base/sources.list',
    }

    # Do Apt update
    exec { 'apt-get update':
        command => '/usr/bin/apt-get update',
        require => File['/etc/apt/sources.list']
    }
}

class util {
    # Installs Curl and Vim
    $packages = [
        'curl',
        'vim'
    ]

    package { $packages:
        ensure => present,
        require => Exec['apt-get update']
    }
}

#include update
#include util
include java::jdk